{{ include './header.html'}}

<body>
  <div id="wrap">
    {{ include './left.html'}}
    <!-- 右侧具体内容栏目 -->
    <div id="rightContent">
      <div id="personInfor" style="text-align: right; background-color:blanchedalmond;">
        <p id="userName">
          <a> 用户:{{adminname}} </a>
          <a href="/admin/login/loginout">退出</a>
        </p>
      </div>

<!--打印机管理模块-->
<div role="tabpanel" class="tab-pane" id="prints">
  <div class="check-div form-inline">
    <div class="col-xs-5">
      <button class="btn btn-yellow btn-xs" data-toggle="modal" data-target="#addPrint">添加打印机
      </button>
      <!-- <button class="btn btn-yellow btn-xs" data-toggle="modal" data-target="#revisePrint">修改打印机</button>
      <button class="btn btn-yellow btn-xs" data-toggle="modal" data-target="#deletePrint">删除打印机</button> -->
    </div>
    <div class="col-xs-4">
      <input type="text" class="form-control input-sm" placeholder="输入文字搜索">
      <button class="btn btn-white btn-xs ">查 询 </button>
    </div>
  </div>
  <div class="data-div">
    <div class="row tableHeader">
      <div class="col-xs-3 ">
        PrinterUuid
      </div>
      <div class="col-xs-1 ">
        bid
      </div>
      <div class="col-xs-2 ">
        deviceid
      </div>
      <div class="col-xs-2">
        打印机名
      </div>
      <div class="col-xs-2">
        二维码
      </div>
      <div class="col-xs-2">
        操作
      </div>
    </div>

    <div class="tablebody">
      <% for(var i=0; i<printlist.length; i++) {%>
        <div class="row">
          <div class="col-xs-3 ">
            <%= printlist[i].printerUuid %>
          </div>
          <div class="col-xs-1 ">
            <%= printlist[i].bid %>
          </div>
          <div class="col-xs-2">
            <%= printlist[i].deviceid %>
          </div>
          <div class="col-xs-2">
            <%= printlist[i].printerName %>
          </div>
          <div class="col-xs-2">
            <img src="/api/print/qr_image?text={{printlist[i].printerUuid}}" style="height: auto; width: auto; max-width: 40%; max-height: 40%;"" alt="打印机二维码">
          </div>
          <div class="col-xs-2">
            <button class="btn btn-success btn-xs" data-toggle="modal" data-target="#revisePrint" onclick="editInfo({{printlist[i]}})">修改</button>
            <button class="btn btn-danger btn-xs" data-toggle="modal" data-target="#deletePrint" onclick="deletePrint({{printlist[i]}})">删除</button>
          </div>

        </div>
        <% } %>

    </div>
    <div class="pagination" id="pagination2" style="float: right; background-color: cornflowerblue; "></div>

  </div>
  <!--页码块-->
  <script type="text/javascript" src="../../js/jqPaginator.js"></script>
  <script>
    $('#pagination2').jqPaginator({
      totalPages: {{ printtotalPages }},
      visiblePages: 8,
      currentPage: {{ currentPage }},
      onPageChange: function (num, type) {
        console.log(num, type)
        if (type == 'change') {
          location.href = "/admin/index/printnextpage?page=" + num
        }
      }
    })

  </script>

  <script>
    function editInfo(obj) {
        // //向模态框中传值
        $('#printerUuid').val(obj.printerUuid);
        $('#bid').val(obj.bid);
        $('#deviceid').val(obj.deviceid);
        $('#printName').val(obj.printName);
        $('#Brand').val(obj.brand);
        $('#model').val(obj.model);
        // $('#update').modal('show');
      }

    function deletePrint(obj) {
          // console.log(obj)
          $('#printerUuid1').val(obj.printerUuid);
    }
  </script>

  <!--弹出添加打印机窗口-->
  <div class="modal fade" id="addPrint" role="dialog" aria-labelledby="gridSystemModalLabel">
    <div class="modal-dialog" role="document">
      <div class="modal-content">
        <div class="modal-header">
          <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
              aria-hidden="true">&times;</span></button>
          <h4 class="modal-title" id="gridSystemModalLabel">添加打印机</h4>
        </div>
        <div class="modal-body">
          <div class="container-fluid">
            <form class="form-horizontal" action="/admin/index/addPrint" method="POST">
              <div class="form-group ">
                <label for="sName" class="col-xs-3 control-label">打印机bid：</label>
                <div class="col-xs-8 ">
                  <input type="text" class="form-control input-sm duiqi" name="bid" placeholder=" " required>
                </div>
              </div>

              <div class="form-group ">
                <label for="sName" class="col-xs-3 control-label">deviceid：</label>
                <div class="col-xs-8 ">
                  <input type="text" class="form-control input-sm duiqi" name="deviceid" placeholder=" " required>
                </div>
              </div>

              <div class="form-group ">
                <label for="sName" class="col-xs-3 control-label">打印机名：</label>
                <div class="col-xs-8 ">
                  <input type="text" class="form-control input-sm duiqi" name="printName" placeholder="打印机名">
                </div>
              </div>

              <div class="form-group ">
                <label for="sName" class="col-xs-3 control-label">品牌：</label>
                <div class="col-xs-8 ">
                  <input type="text" class="form-control input-sm duiqi" name="Brand" placeholder="  ">
                </div>
              </div>

              <div class="form-group ">
                <label for="sName" class="col-xs-3 control-label">型号：</label>
                <div class="col-xs-8 ">
                  <input type="text" class="form-control input-sm duiqi" name="model" placeholder="  ">
                </div>
              </div>

              <div class="form-group">
                <label for="situation" class="col-xs-3 control-label">状态：</label>
                <div class="col-xs-8">
                  <label class="control-label" for="anniu">
                    <input type="radio" name="situation" id="normal">正常</label>
                  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                  <label class="control-label" for="meun">
                    <input type="radio" name="situation" id="forbid">不可用</label>
                </div>
              </div>

              <div class="modal-footer">
                <button type="button" class="btn btn-xs btn-white" data-dismiss="modal">取 消</button>
                <button type="submit" class="btn btn-xs btn-green">保 存</button>
              </div>
            </form>

          </div>
        </div>

      </div>
      <!-- /.modal-content -->
    </div>
    <!-- /.modal-dialog -->
  </div>
  <!-- /.modal -->

  <!--弹出修改打印机窗口-->
  <div class="modal fade" id="revisePrint" role="dialog" aria-labelledby="gridSystemModalLabel">
    <div class="modal-dialog" role="document">
      <div class="modal-content">
        <div class="modal-header">
          <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
              aria-hidden="true">&times;</span></button>
          <h4 class="modal-title" id="gridSystemModalLabel">修改打印机</h4>
        </div>
        <div class="modal-body">
          <div class="container-fluid">
            <form class="form-horizontal" action="/admin/index/updatePrint" method="POST">
              <div class="form-group ">
                <label for="sName" class="col-xs-4 control-label">打印机Uuid：</label>
                <div class="col-xs-8 ">
                  <input type="text" class="form-control input-sm duiqi" name="printerUuid" id="printerUuid" readonly>
                </div>
              </div>

              <div class="form-group ">
                <label for="sName" class="col-xs-4 control-label">打印机bid：</label>
                <div class="col-xs-8 ">
                  <input type="text" class="form-control input-sm duiqi" name="bid" id="bid" placeholder=" ">
                </div>
              </div>

              <div class="form-group ">
                <label for="sName" class="col-xs-4 control-label">deviceid：</label>
                <div class="col-xs-8 ">
                  <input type="text" class="form-control input-sm duiqi" name="deviceid" id="deviceid" placeholder=" ">
                </div>
              </div>

              <div class="form-group ">
                <label for="sName" class="col-xs-4 control-label">打印机名：</label>
                <div class="col-xs-8 ">
                  <input type="text" class="form-control input-sm duiqi" name="printName" id="printName" placeholder="打印机名">
                </div>
              </div>

              <div class="form-group ">
                <label for="sName" class="col-xs-4 control-label">品牌：</label>
                <div class="col-xs-8 ">
                  <input type="text" class="form-control input-sm duiqi" name="Brand" id="Brand" placeholder="  ">
                </div>
              </div>

              <div class="form-group ">
                <label for="sName" class="col-xs-4 control-label">型号：</label>
                <div class="col-xs-8 ">
                  <input type="text" class="form-control input-sm duiqi" name="model" id="model" placeholder="  ">
                </div>
              </div>

              <div class="form-group">
                <label for="situation" class="col-xs-4 control-label">状态：</label>
                <div class="col-xs-8">
                  <label class="control-label" for="anniu">
                    <input type="radio" name="situation" id="normal">正常</label>
                  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                  <label class="control-label" for="meun">
                    <input type="radio" name="situation" id="forbid">不可用</label>
                </div>
              </div>

              <div class="modal-footer">
                <button type="button" class="btn btn-xs btn-white" data-dismiss="modal">取 消</button>
                <button type="submit" class="btn btn-xs btn-green">保 存</button>
              </div>
            </form>
          </div>
        </div>

      </div>
      <!-- /.modal-content -->
    </div>
    <!-- /.modal-dialog -->
  </div>
  <!-- /.modal -->

  <!--弹出删除打印机警告窗口-->
  <div class="modal fade" id="deletePrint" role="dialog" aria-labelledby="gridSystemModalLabel">
    <div class="modal-dialog" role="document">
      <div class="modal-content">
        <div class="modal-header">
          <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
              aria-hidden="true">&times;</span></button>
          <h4 class="modal-title" id="gridSystemModalLabel">提示</h4>
        </div>
        <div class="modal-body">
          <div class="container-fluid">
            <form class="form-horizontal" action="/admin/index/deletePrint" method="POST">
              确定要删除该打印机？删除后不可恢复！
              <div class="form-group ">
                <label for="sName" class="col-xs-4 control-label">打印机Uuid：</label>
                <div class="col-xs-8 ">
                  <input type="text" class="form-control input-sm duiqi" name="printerUuid" id="printerUuid1" placeholder=" " readonly>
                </div>
              </div>
              <div class="modal-footer">
                <button type="button" class="btn btn-xs btn-white" data-dismiss="modal">取 消</button>
                <button type="submit" class="btn  btn-xs btn-danger">确定</button>
              </div>
            </form>
          </div>
        </div>

      </div>
      <!-- /.modal-content -->
    </div>
    <!-- /.modal-dialog -->
  </div>
  <!-- /.modal -->
</div>
    </div>
    </div>
    
    </body>
    
    </html>